package com.rjwh.dingdong.client.mvp.model.impl;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.application.MyApplication;
import com.rjwh.dingdong.client.constant.LocalConstant;
import com.rjwh.dingdong.client.constant.NetConstant;
import com.rjwh.dingdong.client.mvp.BaseModel;
import com.rjwh.dingdong.client.mvp.BasePresenter;
import com.rjwh.dingdong.client.mvp.model.ICommunityPostMyMainPageModel;
import com.rjwh.dingdong.client.network.HttpWebService;
import com.rjwh.dingdong.client.network.HttpWebServiceCallBack;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Kay
 * @ClassName CommunityPostMyMainPageModel
 * @Description
 * @date 2016-7-29
 * @history 2016-7-29 author: description:
 */
public class CommunityPostMyMainPageModel extends BaseModel implements ICommunityPostMyMainPageModel, HttpWebServiceCallBack {

    public CommunityPostMyMainPageModel(BasePresenter basePresenter) {
        super(basePresenter);
    }

    /**
     * 获取个人主页
     *
     * @param posterid 发帖人id
     * @param pageNumber 页码
     * @param isRefresh  是否刷新
     */
    @Override
    public void doGetMyMainPage(String posterid,int pageNumber, boolean isRefresh) {
        Map<String, String> getMyMainPageParams = new HashMap<>();
        getMyMainPageParams.put("posterid", posterid);
        getMyMainPageParams.put("pageindex", Integer.toString(pageNumber));
        HttpWebService.getDataFromServer(NetConstant.COMMUNITY_GETMYMAINPAGE, getMyMainPageParams, isRefresh, this);
    }

    @Override
    public void onServerDataAcquired(int businessType, AsResult mAsResult, boolean isRefresh) {
        if (getBasePresenter() != null) {
            getBasePresenter().onServerDataAcquired(businessType, mAsResult, isRefresh);
        }
    }
}
